<!DOCTYPE html>
<html>
  <body>

    <script type="text/javascript">

      function Test() {
         this.func = function() {
           alert("defined by this");
         };
      }

      Test.prototype.func = function() {
         alert("defined by prototype");
      };

      var _o = new Test();
      _o.func(); //输出“defined by this”

    </script>

  </body>

</html>
